export const ActType = {
	tuan: 0,
	chang: 1,
	man: 2,
	jifen: 3,
	qiang: 4,
};

export const ActCarrier = {
	coupon: 0,
	product: 1,
};

export const ObtainWays = {
	give: 0,
	buy: 1,
	exchange: 2,
};

export const CouponsScope = {
  self: 0,
  dif: 1,
}

function getConsumeValue(data){
	return data.consumeValue || "--";
}
function getCarrierPrice(data){
	if(data.activityCarrier === ActCarrier.coupon) {
		return data.coupons?.couponsValue || "--";
	}
	return data.goods?.price || "--";
}

export const ActTypeDetail = {
	[ActType.tuan]: {
		imgSrc: "/static/act/tuan.png",
		operText: "金额",
		getAmountText(data){
			return `当前金额¥${getConsumeValue(data)}元`;
		},
		canText: '您当前还可购买',
		actionText: "购买",
	},
	[ActType.chang]: {
		imgSrc: "/static/act/chang.png",
		operText: "领取",
		getAmountText(data){
			return `当前金额¥${getCarrierPrice(data)}元`;
		},
		canText: '您当前还可领取',
		actionText: "领取",
	},
	[ActType.man]: {
		imgSrc: "/static/act/man.png",
		operText: "赠送",
		getAmountText(data){
			return `当前金额¥${getCarrierPrice(data)}元`;
		},
		canText: '您当前还可获取',
		actionText: "获取",
	},
	[ActType.jifen]: {
		imgSrc: "/static/act/jifen.png",
		operText: "积分",
		getAmountText(data){
			return `当前积分${getConsumeValue(data)}`;
		},
		canText: '您当前还可兑换',
		actionText: "兑换",
	},
	[ActType.qiang]: {
		imgSrc: "/static/act/qiang.png",
		operText: "金额",
		getAmountText(data){
			return `当前金额¥${getConsumeValue(data)}元`;
		},
		canText: '您当前还可购买',
		actionText: "购买",
	},
};
 